package cn.fanxin.tools;

import java.util.HashMap;
import java.util.List;

/**
 * @Author: china-fanxin
 * @Website: https://fan-xin.cn
 * @Date: 2022/11/24 14:53
 * @Description: 以SQL多行注释形式，打印解析过程非报错信息
 */
public class CommonPrint {

    /**
     * @Author: china-fanxin
     * @Website: https://fan-xin.cn
     * @Description: 打印欢迎语句
     * @Date: 2022/11/26 23:25
     * @Param: []
     * @return: void
     */
    public static void printWelcome() {
        System.out.println("/*\n" +
                "   ______         ____        ____  _____       ______   \n" +
                "  |_   _ \\      .'    `.    |_   \\|_   _|    .' ___  | \n" +
                "    | |_) |    /  .--.  \\     |   \\ | |     / .'   \\_| \n" +
                "    | 数_'.    | | 据 |  |     | |\\集\\| |    | | 市       \n" +
                "   _| |__) |   \\  `--'  /    _| |_\\   |_    \\ `.___.'\\\n" +
                "  |_______/     `.____.'     |____|\\____|    `._____.'\n" +
                "\nPowered by parseIndicator.jar" +
                "\nDesigned by FanXin(https://fan-xin.cn)" +
                "\n*/\n\n"
        );
    }

    /**
     * @Author: china-fanxin
     * @Website: https://fan-xin.cn
     * @Description: 打印基础指标加工语句解析开始语句
     * @Date: 2022/11/26 23:28
     * @Param: []
     * @return: void
     */
    public static void printDeletSqlInfo(){
        System.out.println("\n/*\n" +
                " * 删除历史账期数据语句：\n" +
                " * Powered By parseIndicator.jar \n" +
                " * Designed By FanXin(https://fan-xin.cn)\n" +
                " */\n");
    }


    /**
     * @Author: china-fanxin
     * @Website: https://fan-xin.cn
     * @Description: 打印添加分区语句
     * @Date 2023/4/3 11:55
     * @Param: []
     * @Return: void
     */
    public static void printAddPartSqlInfo(){
        System.out.println("\n/*\n" +
                " * 添加分区数据语句：\n" +
                " * Powered By parseIndicator.jar \n" +
                " * Designed By FanXin(https://fan-xin.cn)\n" +
                " */\n");
    }

    /**
     * @Author: china-fanxin
     * @Website: https://fan-xin.cn
     * @Description: 打印基础指标加工语句解析开始语句
     * @Date: 2022/11/26 23:28
     * @Param: []
     * @return: void
     */
    public static void printBaseSqlStart(){
        System.out.println("\n/*\n" +
                " * 基础指标加工语句生成：当期值、相关衍生值\n" +
                " * Powered By parseIndicator.jar \n" +
                " * Designed By FanXin(https://fan-xin.cn)\n" +
                " */\n");
    }


    /**
     * @Author: china-fanxin
     * @Website: https://fan-xin.cn
     * @Description: 打印基础指标加工语句解析开始语句
     * @Date: 2022/11/26 23:28
     * @Param: []
     * @return: void
     */
    public static void printBaseMidSqlStart(){
        System.out.println("\n/*\n" +
                " * 基础指标加工语句生成：当期值\n" +
                " * Powered By parseIndicator.jar \n" +
                " * Designed By FanXin(https://fan-xin.cn)\n" +
                " */\n");
    }


    /**
     * @Author: china-fanxin
     * @Website: https://fan-xin.cn
     * @Description: 打印基础指标加工语句解析开始语句
     * @Date: 2022/11/26 23:28
     * @Param: []
     * @return: void
     */
    public static void printJsMidSqlStart(){
        System.out.println("\n/*\n" +
                " * 计算指标加工语句生成：当期值\n" +
                " * Powered By parseIndicator.jar \n" +
                " * Designed By FanXin(https://fan-xin.cn)\n" +
                " */\n");
    }

    /**
     * @Author: china-fanxin
     * @Website: https://fan-xin.cn
     * @Description: 打印计算指标加工语句解析开始语句
     * @Date: 2022/11/26 23:28
     * @Param: []
     * @return: void
     */
    public static void printJsSqlStart(){
        System.out.println("\n/*\n" +
                " * 计算指标加工语句生成\n" +
                " * Powered By parseIndicator.jar \n" +
                " * Designed By FanXin(https://fan-xin.cn)\n" +
                " */\n");
    }

    /**
     * @Author: china-fanxin
     * @Website: https://fan-xin.cn
     * @Description: 打印汇总值加工语句解析开始语句
     * @Date: 2022/11/26 23:28
     * @Param: []
     * @return: void
     */
    public static void printSumSqlStart(){
        System.out.println("\n/*\n" +
                " * 基础指标的汇总值加工语句生成：地市合计、省份合计、全国合计、北10合计、南21合计\n" +
                " * Powered By parseIndicator.jar \n" +
                " * Designed By FanXin(https://fan-xin.cn)\n" +
                " */\n");
    }

    /**
     * @Author: china-fanxin
     * @Website: https://fan-xin.cn
     * @Description: 输出一些需要的信息，在流程中通过正则的方式快捷获取
     * @Date: 2022/11/27 15:39
     * @Param: []
     * @return: void
     */
    public static void printBdiInfo(HashMap<String,String> kpiConfMap, List<String> jsList){
        if (jsList.size()==0){
            String dstTable = kpiConfMap.get("DST_ENTITY_NAME");
            System.out.println("\n/*" +
                    "\n[目标表：" + dstTable + "]" +
                    "\n[触发计算指标列表：" + "]" +
                    "\n*/\n");
        }else {
//            List<List<String>> lists = CommonFun.fixedGrouping(jsList, 3);
//            String res = "";
//            for (int i =0;i<lists.size();i++){
//                res = res + CommonFun.listToString(lists.get(i)) + "|";
//            }
            String dstTable = kpiConfMap.get("DST_ENTITY_NAME");
            System.out.println("\n/*" +
                    "\n[目标表：" + dstTable + "]" +
//                    "\n[触发计算指标列表：" + res.substring(0,res.length()-1) + "]" +
                    "\n[触发计算指标列表：" + CommonFun.listToString(jsList) + "]" +
                    "\n*/\n");
        }
    }
}